/**
 *
 */
import Util;
import OpenApi;
import OpenApiUtil;
import EndpointUtil;

extends OpenApi;


init(config: OpenApi.Config){
  super(config);
  @endpointRule = '';
  
  checkConfig(config);
  @endpoint = getEndpoint('cciotgw', @regionId, @endpointRule, @network, @suffix, @endpointMap, @endpoint);
}

function getEndpoint(productId: string, regionId: string, endpointRule: string, network: string, suffix: string, endpointMap: map[string]string, endpoint: string) throws: string{
  if (!Util.empty(endpoint)) {
    return endpoint;
  }
  
  if (!Util.isUnset(endpointMap) && !Util.empty(endpointMap[regionId])) {
    return endpointMap[regionId];
  }
  return EndpointUtil.getEndpointRules(productId, regionId, endpointRule, network, suffix);
}

model AddCloudConnectorGatewayPrivilegeRequest {
  ioTCloudConnectorGatewayId?: string(name='IoTCloudConnectorGatewayId'),
  regionId?: string(name='RegionId'),
  userAliUid?: string(name='UserAliUid'),
}

model AddCloudConnectorGatewayPrivilegeResponseBody = {
  code?: string(name='Code'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: string(name='Success'),
}

model AddCloudConnectorGatewayPrivilegeResponse = {
  headers: map[string]string(name='headers'),
  body: AddCloudConnectorGatewayPrivilegeResponseBody(name='body'),
}

async function addCloudConnectorGatewayPrivilegeWithOptions(request: AddCloudConnectorGatewayPrivilegeRequest, runtime: Util.RuntimeOptions): AddCloudConnectorGatewayPrivilegeResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.ioTCloudConnectorGatewayId)) {
    query['IoTCloudConnectorGatewayId'] = request.ioTCloudConnectorGatewayId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.userAliUid)) {
    query['UserAliUid'] = request.userAliUid;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'AddCloudConnectorGatewayPrivilege',
    version = '2021-07-21',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function addCloudConnectorGatewayPrivilege(request: AddCloudConnectorGatewayPrivilegeRequest): AddCloudConnectorGatewayPrivilegeResponse {
  var runtime = new Util.RuntimeOptions{};
  return addCloudConnectorGatewayPrivilegeWithOptions(request, runtime);
}

model AddIpToConnectionPoolFromExcelRequest {
  apn?: string(name='Apn'),
  cciotGwId?: string(name='CciotGwId'),
  cciotId?: string(name='CciotId'),
  connectionPoolId?: string(name='ConnectionPoolId'),
  ipOssExcelName?: string(name='IpOssExcelName'),
  isp?: string(name='Isp'),
  regionId?: string(name='RegionId'),
  status?: string(name='Status'),
}

model AddIpToConnectionPoolFromExcelResponseBody = {
  asynToken?: string(name='AsynToken'),
  code?: string(name='Code'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: string(name='Success'),
}

model AddIpToConnectionPoolFromExcelResponse = {
  headers: map[string]string(name='headers'),
  body: AddIpToConnectionPoolFromExcelResponseBody(name='body'),
}

async function addIpToConnectionPoolFromExcelWithOptions(request: AddIpToConnectionPoolFromExcelRequest, runtime: Util.RuntimeOptions): AddIpToConnectionPoolFromExcelResponse {
  Util.validateModel(request);
  var query = OpenApiUtil.query(Util.toMap(request));
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'AddIpToConnectionPoolFromExcel',
    version = '2021-07-21',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'GET',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function addIpToConnectionPoolFromExcel(request: AddIpToConnectionPoolFromExcelRequest): AddIpToConnectionPoolFromExcelResponse {
  var runtime = new Util.RuntimeOptions{};
  return addIpToConnectionPoolFromExcelWithOptions(request, runtime);
}

model AllocateIpsRequest {
  apn?: string(name='Apn'),
  cciotGwId?: string(name='CciotGwId'),
  clientToken?: string(name='ClientToken'),
  dryRun?: boolean(name='DryRun'),
  ipCount?: int32(name='IpCount'),
  ips?: [ string ](name='Ips'),
  isp?: string(name='Isp'),
  regionId?: string(name='RegionId'),
}

model AllocateIpsResponseBody = {
  asynToken?: string(name='AsynToken'),
  code?: string(name='Code'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: string(name='Success'),
}

model AllocateIpsResponse = {
  headers: map[string]string(name='headers'),
  body: AllocateIpsResponseBody(name='body'),
}

async function allocateIpsWithOptions(request: AllocateIpsRequest, runtime: Util.RuntimeOptions): AllocateIpsResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.apn)) {
    query['Apn'] = request.apn;
  }
  if (!Util.isUnset(request.cciotGwId)) {
    query['CciotGwId'] = request.cciotGwId;
  }
  if (!Util.isUnset(request.clientToken)) {
    query['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.dryRun)) {
    query['DryRun'] = request.dryRun;
  }
  if (!Util.isUnset(request.ipCount)) {
    query['IpCount'] = request.ipCount;
  }
  if (!Util.isUnset(request.ips)) {
    query['Ips'] = request.ips;
  }
  if (!Util.isUnset(request.isp)) {
    query['Isp'] = request.isp;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'AllocateIps',
    version = '2021-07-21',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function allocateIps(request: AllocateIpsRequest): AllocateIpsResponse {
  var runtime = new Util.RuntimeOptions{};
  return allocateIpsWithOptions(request, runtime);
}

model AssociateIccidToIpRequest {
  apn?: string(name='Apn'),
  cciotGwId?: string(name='CciotGwId'),
  clientToken?: string(name='ClientToken'),
  iccidIpList?: [ 
    {
      cardType?: string(name='CardType'),
      iccid?: string(name='Iccid'),
      ip?: string(name='Ip'),
    }
  ](name='IccidIpList'),
  isp?: string(name='Isp'),
  regionId?: string(name='RegionId'),
}

model AssociateIccidToIpResponseBody = {
  code?: string(name='Code'),
  errorIpList?: [ 
    {
      cause?: string(name='Cause'),
      ip?: string(name='Ip'),
    }
  ](name='ErrorIpList'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: string(name='Success'),
}

model AssociateIccidToIpResponse = {
  headers: map[string]string(name='headers'),
  body: AssociateIccidToIpResponseBody(name='body'),
}

async function associateIccidToIpWithOptions(request: AssociateIccidToIpRequest, runtime: Util.RuntimeOptions): AssociateIccidToIpResponse {
  Util.validateModel(request);
  var query = OpenApiUtil.query(Util.toMap(request));
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'AssociateIccidToIp',
    version = '2021-07-21',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'GET',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function associateIccidToIp(request: AssociateIccidToIpRequest): AssociateIccidToIpResponse {
  var runtime = new Util.RuntimeOptions{};
  return associateIccidToIpWithOptions(request, runtime);
}

model AssociateIccidToIpExcelRequest {
  apn?: string(name='Apn'),
  cciotGwId?: string(name='CciotGwId'),
  clientToken?: string(name='ClientToken'),
  iccidIpsFileUrlList?: [ string ](name='IccidIpsFileUrlList'),
  isp?: string(name='Isp'),
  regionId?: string(name='RegionId'),
}

model AssociateIccidToIpExcelResponseBody = {
  asynToken?: string(name='AsynToken'),
  code?: string(name='Code'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: string(name='Success'),
}

model AssociateIccidToIpExcelResponse = {
  headers: map[string]string(name='headers'),
  body: AssociateIccidToIpExcelResponseBody(name='body'),
}

async function associateIccidToIpExcelWithOptions(request: AssociateIccidToIpExcelRequest, runtime: Util.RuntimeOptions): AssociateIccidToIpExcelResponse {
  Util.validateModel(request);
  var query = OpenApiUtil.query(Util.toMap(request));
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'AssociateIccidToIpExcel',
    version = '2021-07-21',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'GET',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function associateIccidToIpExcel(request: AssociateIccidToIpExcelRequest): AssociateIccidToIpExcelResponse {
  var runtime = new Util.RuntimeOptions{};
  return associateIccidToIpExcelWithOptions(request, runtime);
}

model DeleteCloudConnectorGatewayPrivilegeRequest {
  ioTCloudConnectorGatewayId?: string(name='IoTCloudConnectorGatewayId'),
  regionId?: string(name='RegionId'),
  userAliUid?: string(name='UserAliUid'),
}

model DeleteCloudConnectorGatewayPrivilegeResponseBody = {
  code?: string(name='Code'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: string(name='Success'),
}

model DeleteCloudConnectorGatewayPrivilegeResponse = {
  headers: map[string]string(name='headers'),
  body: DeleteCloudConnectorGatewayPrivilegeResponseBody(name='body'),
}

async function deleteCloudConnectorGatewayPrivilegeWithOptions(request: DeleteCloudConnectorGatewayPrivilegeRequest, runtime: Util.RuntimeOptions): DeleteCloudConnectorGatewayPrivilegeResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.ioTCloudConnectorGatewayId)) {
    query['IoTCloudConnectorGatewayId'] = request.ioTCloudConnectorGatewayId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.userAliUid)) {
    query['UserAliUid'] = request.userAliUid;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DeleteCloudConnectorGatewayPrivilege',
    version = '2021-07-21',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function deleteCloudConnectorGatewayPrivilege(request: DeleteCloudConnectorGatewayPrivilegeRequest): DeleteCloudConnectorGatewayPrivilegeResponse {
  var runtime = new Util.RuntimeOptions{};
  return deleteCloudConnectorGatewayPrivilegeWithOptions(request, runtime);
}

model GetFreeIpCountRequest {
  apn?: string(name='Apn'),
  cciotGwId?: string(name='CciotGwId'),
  isp?: string(name='Isp'),
  regionId?: string(name='RegionId'),
}

model GetFreeIpCountResponseBody = {
  code?: string(name='Code'),
  count?: int32(name='Count'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: string(name='Success'),
}

model GetFreeIpCountResponse = {
  headers: map[string]string(name='headers'),
  body: GetFreeIpCountResponseBody(name='body'),
}

async function getFreeIpCountWithOptions(request: GetFreeIpCountRequest, runtime: Util.RuntimeOptions): GetFreeIpCountResponse {
  Util.validateModel(request);
  var query = OpenApiUtil.query(Util.toMap(request));
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetFreeIpCount',
    version = '2021-07-21',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'GET',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getFreeIpCount(request: GetFreeIpCountRequest): GetFreeIpCountResponse {
  var runtime = new Util.RuntimeOptions{};
  return getFreeIpCountWithOptions(request, runtime);
}

model GetIccidAndIpRequest {
  apn?: string(name='Apn'),
  cciotGwId?: string(name='CciotGwId'),
  clientToken?: string(name='ClientToken'),
  iccid?: string(name='Iccid'),
  ip?: string(name='Ip'),
  isp?: string(name='Isp'),
  regionId?: string(name='RegionId'),
}

model GetIccidAndIpResponseBody = {
  cciotId?: string(name='CciotId'),
  code?: string(name='Code'),
  iccid?: string(name='Iccid'),
  ip?: string(name='Ip'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  status?: string(name='Status'),
  success?: string(name='Success'),
}

model GetIccidAndIpResponse = {
  headers: map[string]string(name='headers'),
  body: GetIccidAndIpResponseBody(name='body'),
}

async function getIccidAndIpWithOptions(request: GetIccidAndIpRequest, runtime: Util.RuntimeOptions): GetIccidAndIpResponse {
  Util.validateModel(request);
  var query = OpenApiUtil.query(Util.toMap(request));
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetIccidAndIp',
    version = '2021-07-21',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'GET',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getIccidAndIp(request: GetIccidAndIpRequest): GetIccidAndIpResponse {
  var runtime = new Util.RuntimeOptions{};
  return getIccidAndIpWithOptions(request, runtime);
}

model GetIoTCloudConnectorGatewayRequest {
  ioTCloudConnectorGatewayId?: string(name='IoTCloudConnectorGatewayId'),
  regionId?: string(name='RegionId'),
}

model GetIoTCloudConnectorGatewayResponseBody = {
  apn?: string(name='Apn'),
  description?: string(name='Description'),
  featureList?: [ string ](name='FeatureList'),
  forwardingUnitCount?: int32(name='ForwardingUnitCount'),
  forwardingUnitIds?: [ string ](name='ForwardingUnitIds'),
  haMode?: string(name='HaMode'),
  ioTCloudConnectorGatewayId?: string(name='IoTCloudConnectorGatewayId'),
  isp?: string(name='Isp'),
  name?: string(name='Name'),
  requestId?: string(name='RequestId'),
  resourceUid?: long(name='ResourceUid'),
  scheduleFactor?: map[string]any(name='ScheduleFactor'),
  spec?: string(name='Spec'),
  state?: string(name='State'),
  zoneList?: [ string ](name='ZoneList'),
}

model GetIoTCloudConnectorGatewayResponse = {
  headers: map[string]string(name='headers'),
  body: GetIoTCloudConnectorGatewayResponseBody(name='body'),
}

async function getIoTCloudConnectorGatewayWithOptions(request: GetIoTCloudConnectorGatewayRequest, runtime: Util.RuntimeOptions): GetIoTCloudConnectorGatewayResponse {
  Util.validateModel(request);
  var query = OpenApiUtil.query(Util.toMap(request));
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetIoTCloudConnectorGateway',
    version = '2021-07-21',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'GET',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getIoTCloudConnectorGateway(request: GetIoTCloudConnectorGatewayRequest): GetIoTCloudConnectorGatewayResponse {
  var runtime = new Util.RuntimeOptions{};
  return getIoTCloudConnectorGatewayWithOptions(request, runtime);
}

model GetIpStatusRequest {
  apn?: string(name='Apn'),
  cciotGwId?: string(name='CciotGwId'),
  ip?: string(name='Ip'),
  isp?: string(name='Isp'),
  regionId?: string(name='RegionId'),
}

model GetIpStatusResponseBody = {
  code?: string(name='Code'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  status?: string(name='Status'),
  success?: string(name='Success'),
}

model GetIpStatusResponse = {
  headers: map[string]string(name='headers'),
  body: GetIpStatusResponseBody(name='body'),
}

async function getIpStatusWithOptions(request: GetIpStatusRequest, runtime: Util.RuntimeOptions): GetIpStatusResponse {
  Util.validateModel(request);
  var query = OpenApiUtil.query(Util.toMap(request));
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetIpStatus',
    version = '2021-07-21',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'GET',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getIpStatus(request: GetIpStatusRequest): GetIpStatusResponse {
  var runtime = new Util.RuntimeOptions{};
  return getIpStatusWithOptions(request, runtime);
}

model ListCloudConnectorGatewayPrivilegeRequest {
  ioTCloudConnectorGatewayId?: string(name='IoTCloudConnectorGatewayId'),
  regionId?: string(name='RegionId'),
}

model ListCloudConnectorGatewayPrivilegeResponseBody = {
  code?: string(name='Code'),
  ioTCloudConnectorGatewayId?: string(name='IoTCloudConnectorGatewayId'),
  ioTCloudConnectorGatewayPrivileges?: [ 
    {
      aliuid?: string(name='Aliuid'),
      type?: string(name='Type'),
    }
  ](name='IoTCloudConnectorGatewayPrivileges'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: string(name='Success'),
}

model ListCloudConnectorGatewayPrivilegeResponse = {
  headers: map[string]string(name='headers'),
  body: ListCloudConnectorGatewayPrivilegeResponseBody(name='body'),
}

async function listCloudConnectorGatewayPrivilegeWithOptions(request: ListCloudConnectorGatewayPrivilegeRequest, runtime: Util.RuntimeOptions): ListCloudConnectorGatewayPrivilegeResponse {
  Util.validateModel(request);
  var query = OpenApiUtil.query(Util.toMap(request));
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListCloudConnectorGatewayPrivilege',
    version = '2021-07-21',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'GET',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function listCloudConnectorGatewayPrivilege(request: ListCloudConnectorGatewayPrivilegeRequest): ListCloudConnectorGatewayPrivilegeResponse {
  var runtime = new Util.RuntimeOptions{};
  return listCloudConnectorGatewayPrivilegeWithOptions(request, runtime);
}

model ListConnectionPoolIpRequest {
  apn?: string(name='Apn'),
  cciotGwId?: string(name='CciotGwId'),
  cciotId?: string(name='CciotId'),
  clientToken?: string(name='ClientToken'),
  connectionPoolId?: string(name='ConnectionPoolId'),
  ip?: string(name='Ip'),
  isp?: string(name='Isp'),
  pageId?: string(name='PageId'),
  pageSize?: int32(name='PageSize'),
  regionId?: string(name='RegionId'),
  status?: string(name='Status'),
}

model ListConnectionPoolIpResponseBody = {
  code?: string(name='Code'),
  count?: long(name='Count'),
  ipInfoList?: [ 
    {
      cciotId?: string(name='CciotId'),
      connectionPoolId?: string(name='ConnectionPoolId'),
      ip?: string(name='Ip'),
      status?: string(name='Status'),
    }
  ](name='IpInfoList'),
  message?: string(name='Message'),
  pageId?: string(name='PageId'),
  pageSize?: long(name='PageSize'),
  requestId?: string(name='RequestId'),
  success?: string(name='Success'),
}

model ListConnectionPoolIpResponse = {
  headers: map[string]string(name='headers'),
  body: ListConnectionPoolIpResponseBody(name='body'),
}

async function listConnectionPoolIpWithOptions(request: ListConnectionPoolIpRequest, runtime: Util.RuntimeOptions): ListConnectionPoolIpResponse {
  Util.validateModel(request);
  var query = OpenApiUtil.query(Util.toMap(request));
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListConnectionPoolIp',
    version = '2021-07-21',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'GET',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function listConnectionPoolIp(request: ListConnectionPoolIpRequest): ListConnectionPoolIpResponse {
  var runtime = new Util.RuntimeOptions{};
  return listConnectionPoolIpWithOptions(request, runtime);
}

model ListGreInterfacesRequest {
  greInterfaceId?: string(name='GreInterfaceId'),
  ioTCloudConnectorGatewayId?: string(name='IoTCloudConnectorGatewayId'),
  regionId?: string(name='RegionId'),
}

model ListGreInterfacesResponseBody = {
  greInterface?: [ 
    {
      customerIp?: string(name='CustomerIp'),
      customerTunnelIp?: string(name='CustomerTunnelIp'),
      enableKeepalive?: boolean(name='EnableKeepalive'),
      forwardingUnitId?: string(name='ForwardingUnitId'),
      greCidrs?: string(name='GreCidrs'),
      greGwId?: string(name='GreGwId'),
      greInterfaceId?: string(name='GreInterfaceId'),
      ioTCloudConnectorGatewayId?: string(name='IoTCloudConnectorGatewayId'),
      localIp?: string(name='LocalIp'),
      localTunnelIp?: string(name='LocalTunnelIp'),
      state?: string(name='State'),
    }
  ](name='GreInterface'),
  ioTCloudConnectorGatewayId?: string(name='IoTCloudConnectorGatewayId'),
  requestId?: string(name='RequestId'),
}

model ListGreInterfacesResponse = {
  headers: map[string]string(name='headers'),
  body: ListGreInterfacesResponseBody(name='body'),
}

async function listGreInterfacesWithOptions(request: ListGreInterfacesRequest, runtime: Util.RuntimeOptions): ListGreInterfacesResponse {
  Util.validateModel(request);
  var query = OpenApiUtil.query(Util.toMap(request));
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListGreInterfaces',
    version = '2021-07-21',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'GET',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function listGreInterfaces(request: ListGreInterfacesRequest): ListGreInterfacesResponse {
  var runtime = new Util.RuntimeOptions{};
  return listGreInterfacesWithOptions(request, runtime);
}

model ListIoTCloudConnectorGatewaysRequest {
  pageNumber?: int32(name='PageNumber'),
  pageSize?: int32(name='PageSize'),
  regionId?: string(name='RegionId'),
}

model ListIoTCloudConnectorGatewaysResponseBody = {
  ioTCloudConnectorGateways?: [ 
    {
      apn?: string(name='Apn'),
      description?: string(name='Description'),
      featureList?: [ string ](name='FeatureList'),
      forwardingUnitCount?: int32(name='ForwardingUnitCount'),
      forwardingUnitIds?: [ string ](name='ForwardingUnitIds'),
      ioTCloudConnectorGatewayId?: string(name='IoTCloudConnectorGatewayId'),
      isp?: string(name='Isp'),
      name?: string(name='Name'),
      resourceUid?: long(name='ResourceUid'),
      scheduleFactor?: map[string]any(name='ScheduleFactor'),
      spec?: string(name='Spec'),
      state?: string(name='State'),
      zoneList?: [ string ](name='ZoneList'),
    }
  ](name='IoTCloudConnectorGateways'),
  pageNumber?: int32(name='PageNumber'),
  pageSize?: int32(name='PageSize'),
  requestId?: string(name='RequestId'),
  totalCount?: int32(name='TotalCount'),
}

model ListIoTCloudConnectorGatewaysResponse = {
  headers: map[string]string(name='headers'),
  body: ListIoTCloudConnectorGatewaysResponseBody(name='body'),
}

async function listIoTCloudConnectorGatewaysWithOptions(request: ListIoTCloudConnectorGatewaysRequest, runtime: Util.RuntimeOptions): ListIoTCloudConnectorGatewaysResponse {
  Util.validateModel(request);
  var query = OpenApiUtil.query(Util.toMap(request));
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListIoTCloudConnectorGateways',
    version = '2021-07-21',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'GET',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function listIoTCloudConnectorGateways(request: ListIoTCloudConnectorGatewaysRequest): ListIoTCloudConnectorGatewaysResponse {
  var runtime = new Util.RuntimeOptions{};
  return listIoTCloudConnectorGatewaysWithOptions(request, runtime);
}

model ListIpsStatusRequest {
  apn?: string(name='Apn'),
  cciotGwId?: string(name='CciotGwId'),
  ips?: [ string ](name='Ips'),
  isp?: string(name='Isp'),
  regionId?: string(name='RegionId'),
}

model ListIpsStatusResponseBody = {
  code?: string(name='Code'),
  ips?: [ 
    {
      ip?: string(name='Ip'),
      status?: string(name='Status'),
    }
  ](name='Ips'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: string(name='Success'),
}

model ListIpsStatusResponse = {
  headers: map[string]string(name='headers'),
  body: ListIpsStatusResponseBody(name='body'),
}

async function listIpsStatusWithOptions(request: ListIpsStatusRequest, runtime: Util.RuntimeOptions): ListIpsStatusResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.apn)) {
    query['Apn'] = request.apn;
  }
  if (!Util.isUnset(request.cciotGwId)) {
    query['CciotGwId'] = request.cciotGwId;
  }
  if (!Util.isUnset(request.ips)) {
    query['Ips'] = request.ips;
  }
  if (!Util.isUnset(request.isp)) {
    query['Isp'] = request.isp;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListIpsStatus',
    version = '2021-07-21',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function listIpsStatus(request: ListIpsStatusRequest): ListIpsStatusResponse {
  var runtime = new Util.RuntimeOptions{};
  return listIpsStatusWithOptions(request, runtime);
}

model ListResultTokenUrlRequest {
  asynToken?: string(name='AsynToken'),
  regionId?: string(name='RegionId'),
}

model ListResultTokenUrlResponseBody = {
  code?: string(name='Code'),
  message?: string(name='Message'),
  ossUrls?: [ string ](name='OssUrls'),
  requestId?: string(name='RequestId'),
  success?: string(name='Success'),
}

model ListResultTokenUrlResponse = {
  headers: map[string]string(name='headers'),
  body: ListResultTokenUrlResponseBody(name='body'),
}

async function listResultTokenUrlWithOptions(request: ListResultTokenUrlRequest, runtime: Util.RuntimeOptions): ListResultTokenUrlResponse {
  Util.validateModel(request);
  var query = OpenApiUtil.query(Util.toMap(request));
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListResultTokenUrl',
    version = '2021-07-21',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'GET',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function listResultTokenUrl(request: ListResultTokenUrlRequest): ListResultTokenUrlResponse {
  var runtime = new Util.RuntimeOptions{};
  return listResultTokenUrlWithOptions(request, runtime);
}

model ModifyIpStatusRequest {
  apn?: string(name='Apn'),
  cciotGwId?: string(name='CciotGwId'),
  clientToken?: string(name='ClientToken'),
  ipList?: [ string ](name='IpList'),
  isp?: string(name='Isp'),
  regionId?: string(name='RegionId'),
  status?: string(name='Status'),
}

model ModifyIpStatusResponseBody = {
  code?: string(name='Code'),
  errorIpList?: [ 
    {
      cause?: string(name='Cause'),
      ip?: string(name='Ip'),
    }
  ](name='ErrorIpList'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: string(name='Success'),
}

model ModifyIpStatusResponse = {
  headers: map[string]string(name='headers'),
  body: ModifyIpStatusResponseBody(name='body'),
}

async function modifyIpStatusWithOptions(request: ModifyIpStatusRequest, runtime: Util.RuntimeOptions): ModifyIpStatusResponse {
  Util.validateModel(request);
  var query = OpenApiUtil.query(Util.toMap(request));
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ModifyIpStatus',
    version = '2021-07-21',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'GET',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function modifyIpStatus(request: ModifyIpStatusRequest): ModifyIpStatusResponse {
  var runtime = new Util.RuntimeOptions{};
  return modifyIpStatusWithOptions(request, runtime);
}

model QueryAsynTokenResultRequest {
  asynToken?: string(name='AsynToken'),
  regionId?: string(name='RegionId'),
}

model QueryAsynTokenResultResponseBody = {
  code?: string(name='Code'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  result?: string(name='Result'),
  status?: string(name='Status'),
  success?: string(name='Success'),
}

model QueryAsynTokenResultResponse = {
  headers: map[string]string(name='headers'),
  body: QueryAsynTokenResultResponseBody(name='body'),
}

async function queryAsynTokenResultWithOptions(request: QueryAsynTokenResultRequest, runtime: Util.RuntimeOptions): QueryAsynTokenResultResponse {
  Util.validateModel(request);
  var query = OpenApiUtil.query(Util.toMap(request));
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'QueryAsynTokenResult',
    version = '2021-07-21',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'GET',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function queryAsynTokenResult(request: QueryAsynTokenResultRequest): QueryAsynTokenResultResponse {
  var runtime = new Util.RuntimeOptions{};
  return queryAsynTokenResultWithOptions(request, runtime);
}

model SwitchVpcRouteToBackUpZoneRequest {
  cciotGwId?: string(name='CciotGwId'),
  clientToken?: string(name='ClientToken'),
  dryRun?: boolean(name='DryRun'),
  greGwId?: string(name='GreGwId'),
  regionId?: string(name='RegionId'),
}

model SwitchVpcRouteToBackUpZoneResponseBody = {
  asynToken?: string(name='AsynToken'),
  code?: string(name='Code'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: string(name='Success'),
}

model SwitchVpcRouteToBackUpZoneResponse = {
  headers: map[string]string(name='headers'),
  body: SwitchVpcRouteToBackUpZoneResponseBody(name='body'),
}

async function switchVpcRouteToBackUpZoneWithOptions(request: SwitchVpcRouteToBackUpZoneRequest, runtime: Util.RuntimeOptions): SwitchVpcRouteToBackUpZoneResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.cciotGwId)) {
    query['CciotGwId'] = request.cciotGwId;
  }
  if (!Util.isUnset(request.clientToken)) {
    query['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.dryRun)) {
    query['DryRun'] = request.dryRun;
  }
  if (!Util.isUnset(request.greGwId)) {
    query['GreGwId'] = request.greGwId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'SwitchVpcRouteToBackUpZone',
    version = '2021-07-21',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function switchVpcRouteToBackUpZone(request: SwitchVpcRouteToBackUpZoneRequest): SwitchVpcRouteToBackUpZoneResponse {
  var runtime = new Util.RuntimeOptions{};
  return switchVpcRouteToBackUpZoneWithOptions(request, runtime);
}

model UnAssociateIccidToIpRequest {
  apn?: string(name='Apn'),
  cciotGwId?: string(name='CciotGwId'),
  clientToken?: string(name='ClientToken'),
  iccidIpList?: [ 
    {
      iccid?: string(name='Iccid'),
      ip?: string(name='Ip'),
    }
  ](name='IccidIpList'),
  isp?: string(name='Isp'),
  regionId?: string(name='RegionId'),
}

model UnAssociateIccidToIpResponseBody = {
  code?: string(name='Code'),
  errorIpList?: [ 
    {
      cause?: string(name='Cause'),
      ip?: string(name='Ip'),
    }
  ](name='ErrorIpList'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: string(name='Success'),
}

model UnAssociateIccidToIpResponse = {
  headers: map[string]string(name='headers'),
  body: UnAssociateIccidToIpResponseBody(name='body'),
}

async function unAssociateIccidToIpWithOptions(request: UnAssociateIccidToIpRequest, runtime: Util.RuntimeOptions): UnAssociateIccidToIpResponse {
  Util.validateModel(request);
  var query = OpenApiUtil.query(Util.toMap(request));
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'UnAssociateIccidToIp',
    version = '2021-07-21',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'GET',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function unAssociateIccidToIp(request: UnAssociateIccidToIpRequest): UnAssociateIccidToIpResponse {
  var runtime = new Util.RuntimeOptions{};
  return unAssociateIccidToIpWithOptions(request, runtime);
}

